#ifndef _Finish_h_
#define _Finish_h_
#include<windows.h>
#include<d3d9.h>
#include"Sprite.h"
#include"Object.h"

class CBodyFlag
{
	int x;
	int y;
	CSprite *body;
public:
	CBodyFlag(Object object);
	~CBodyFlag();
	bool Collision(RECT marioRect);
	void Render(LPD3DXSPRITE sprite,LPDIRECT3DTEXTURE9 image,int time,int xcamara);
};
class CFlag
{
	int x;
	int y;
	CSprite *flag;
public:
	CFlag(Object object);
	~CFlag();
	bool isFlagDown;
	bool Collision(RECT marioRect);
	void FallDown();
	void Render(LPD3DXSPRITE sprite,LPDIRECT3DTEXTURE9 image,int time,int xcamara);
};
class CTopFlag
{
	int x;
	int y;
	CSprite *topflag;
public:
	CTopFlag(Object object);
	~CTopFlag();
	bool Collision(RECT marioRect);
	void Render(LPD3DXSPRITE sprite,LPDIRECT3DTEXTURE9 image,int time,int xcamara);
};
class CNodeBody
{
public:
	CBodyFlag *body;
	CNodeBody *next;
};
class CList
{
public:
	CNodeBody *pHead;
	CNodeBody *pTail;
};
void AddObject(CList &list,CBodyFlag *body);
void EmptyList(CList &list);
class CHome
{
	int x;
	int y;
	CSprite *home;
public:
	CHome(Object object);
	~CHome();
	bool Collision(RECT marioRect);
	//void Render(LPD3DXSPRITE sprite,LPDIRECT3DTEXTURE9 image,int time,int xcamara);
};
class CFinish
{
public:
	CFinish();
	~CFinish();
	CBodyFlag *body;
	CTopFlag *top;
	CFlag *flag;
	CHome *home;
	CList list;
	void GetObjects(Object object);
	void Empty();
	bool Collision(RECT marioRect);
	void Render(LPD3DXSPRITE sprite,LPDIRECT3DTEXTURE9 image,int time,int xcamara);
};
#endif